# -*- coding: utf-8 -*-
# @Time    : 2019/10/21 21:29
# @Author  : LiHaowen
# @Email   : lihaowen2017@163.com
# @File    : socket_client.py
import socket


client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(("127.0.0.1", 8000))  # 连接
while True:
    re_data = input()
    client.send(re_data.encode("utf8"))
    data = client.recv(1024)  # 客户端先发送数据所以打印数据置后
    print(data.decode("utf8"))
    if re_data == "bye" or re_data == "exit":
        break

client.close()
# client.send("b1".encode("utf8"))
# data = client.recv(1024)
# print(data.decode("utf8"))
# client.close()
